import 'package:ca_dsp_pro/src/modules/home/my_home_controller.dart';
import 'package:flutter_kit_dsp/flutter_kit_dsp.dart';
import 'package:flutter_kit_plus/flutter_kit.dart';

class MyHome extends HomePageDelegate<MyHomeController> {
  MyHome({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx(() {
      return Row(
        children: [
          Container(
            width: 70,
            child: Column(
              spacing: 10,
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: List.generate(controller.items.length, (i) {
                return AnimatedScale(
                  scale: controller.currentIndex.value == i ? 0.9 : 1.0, // 点击时微缩
                  duration: const Duration(milliseconds: 100),
                  curve: Curves.easeOut,
                  child: InkResponse(
                    containedInkWell: false,
                    highlightShape: BoxShape.circle,
                    splashColor: Colors.blue.withOpacity(0.3),
                    customBorder: const CircleBorder(),
                    radius: 30,
                    onTap: () => controller.currentIndex.value = i,
                    child: LongPressGestureDetector(
                        duration: Duration(milliseconds: 3000),
                        child: Image.asset(
                            controller.currentIndex.value == i ? controller.items_select[i] : controller.items[i],
                            width: 40,
                            height: 40,
                            fit: BoxFit.fill),
                        onLongPress: () {
                          if (i == 0) {
                            LogRecorder.toggle(context);
                          }
                        }),
                  ),
                );
              }),
            ),
          ),
          Expanded(child: controller.currentPage.value),
        ],
      );
    });
  }
}
